<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo  Q::ini('appini/app_title')." ". Q::ini('appini/version');?></title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="js/jquery-easyui/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="js/jquery-easyui/themes/icon.css"/>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery-easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="js/jquery-easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>

<script language="javascript">


function savedeposti(){  
	
	message="<div style='float:left;'>请确认以下信息是否正确：<br><br>"
		+"会员帐号："+$("#username").val()
		+ "<br>真实姓名：" + $("#name").val()
		+ "<br>实收金额：" + $("#amount").val()
		+ "</div>";
	$.messager.confirm('确认', message, function(r){
		if (r){
		
			$('#fm').form('submit',{  
				url: url,  
				onSubmit: function(){  
					return $(this).form('validate');  
				},  
				success: function(result){  
					var result = eval('('+result+')');  
					if (result.errorMsg){  
						$.messager.show({  
							title: '出错了',  
							msg: result.errorMsg  
						});  
					} else {  
						$('#dlg').dialog('close');      // close the dialog  
						$.messager.show({  
							title: '信息',  
							msg: '操作完成.'
						});  
					}  
				}  
			});  
	
		}
	});
}  


function searchmember(){  
    $('#dlgSearch').dialog('open').dialog('setTitle','查找');  
}

function doSearch(){
	key=$("#key").val()
	op=$("#op").val();
	value=$("#value").val();
	$("#dg").datagrid({ url: '<?=url('member/list')?>', queryParams: { key: key,op:op,value:value} });
	
	$('#dlgSearch').dialog('close');
} 

$(function(){
	$('#dg').datagrid({
		title:'入金操作',
		iconCls:'icon-save',
		width:500,
		height:350,
		fit: true,
		nowrap: true,
		autoRowHeight: true,
		striped: true,
		collapsible:true,
		url:'<?=url('member/list')?>',
		sortName: 'name',
		sortOrder: 'desc',
		remoteSort: false,
		idField:'member_id',
		columns:[[
			{field:'site',title:'站点',width:100},
			{field:'agent',title:'代理',width:100},
			{field:'name',title:'真实姓名',width:100},
			{field:'username',title:'用户帐号',width:100},
			{field:'bank',title:'银行名称',width:100},
			{field:'bank_name',title:'开户行名称',width:100},
			{field:'bank_account',title:'银行帐号',width:100},
			{field:'phone',title:'联系电话',width:100},
			{field:'opt',title:'操作',width:100,align:'center',
				formatter:function(value, rec,rowIndex){
					return "<span style=\"color:red;\"><a href=\"javascript:void(0);\" onclick=\"deposit("+rowIndex+");\">入金</a></span>";
				}
			}
		]],
		pagination:true,
		rownumbers:true,
		toolbar:[{
			id:'btnrefresh',
			text:'刷新',
			iconCls:'icon-refresh',
			handler:function(){
				//alert("刷新");
				$('#dg').datagrid('reload');
				
			}
		},'-',{
			id:'btnsearch',
			text:'查找',
			iconCls:'icon-search',
			handler:function(){
				searchmember();				
			}
		}]
	});
	
});


function deposit(rowIndex){  

	$('#fm').form('clear');  
    $('#dg').datagrid('selectRow',rowIndex); 
	var row = $('#dg').datagrid('getSelected');  
    if (row){  
        $('#dlg').dialog('open').dialog('setTitle','入金');  
        $('#fm').form('load',row);  
		url = '<?=url("deposit/new")?>';
    } 
	else{
		$.messager.show({
			'title': "提示",
			'msg': "请选择要会员."	
		});	
	} 		

} 
</script>


</head>

<body class="easyui-layout" style="overflow-y: hidden" scroll="no">
    
    <div region="center" style="width: 500px; height: 300px; padding: 1px;overflow-y: hidden">
        
       <table id="dg"></table>
    </div>
	<div id="dlg" class="easyui-dialog" style="width:450px;height:500px;padding:10px 20px" closed="true" buttons="#dlg-buttons"  modal="true">  
        
        <form id="fm" method="post">  
            
            <table width="100%" border="0" cellspacing="1" cellpadding="2">
              <tr>
                <td height="25" align="right"><span class="fitem">真实姓名</span></td>
                <td align="left"><span class="fitem">
                  <input name="name" id="name" class="easyui-validatebox" required="true" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right"><span class="fitem">
                  <label>会员帐号:</label>
                </span></td>
                <td align="left"><span class="fitem">
                  <input name="username" id="username" class="easyui-validatebox" required="true" />
                </span></td>
              </tr>
              
              <tr>
                <td height="25" align="right"><span class="fitem">收款银行:</span></td>
                <td align="left"><span class="fitem">
                 <select name="bank_id" id="bank_id" class="easyui-combogrid" data-options="  
            panelWidth:350,            
            idField:'bank_id',  
            textField:'name',  
            url:'<?=url("bank/list")?>',  
            columns:[[  
                {field:'bank_id',title:'编号',width:60},  
                {field:'name',title:'银行名称',width:280}  
            ]]">
                  </select>
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right"><span class="fitem">实际加点数:</span></td>
                <td align="left"><span class="fitem">
                  <input name="point" id="point" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right"><span class="fitem">存款金额:</span></td>
                <td align="left"><span class="fitem">
                  <input name="deposit_amount" id="deposit_amount" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right"><span class="fitem">
                  <label>实收金额:</label>
                </span></td>
                <td align="left"><span class="fitem">
                  <input name="amount" id="amount" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right"><span class="fitem">
                  <label>手续费:</label>
                </span></td>
                <td align="left"><span class="fitem">
                  <input name="factorage" id="factorage" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right">返手续费:</td>
                <td align="left"><span class="fitem">
                  <input name="re_factorage" id="re_factorage" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right">送红利:</td>
                <td align="left"><span class="fitem">
                  <input name="bonus" id="bonus" />
                </span></td>
              </tr>
              <tr>
                <td height="25" align="right"><span class="fitem">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</span></td>
                <td align="left"><span class="fitem">
                  <textarea name="memo" id="memo"></textarea>
                </span></td>
              </tr>
            </table>
      <p>&nbsp;            </p>
            <p>
              <input name="member_id" id="member_id" type="hidden"  />
            </p>
        </form>  
    </div>  
    <div id="dlg-buttons">  
        <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="savedeposti()">提交</a>  
        <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>  
    </div>   
    
    <!--search box-->
    <div id="dlgSearch" class="easyui-dialog" style="width:400px;height:200px;padding:10px 20px" closed="true" buttons="#dlgSearch-buttons"  modal="true"> 
    <form method="post">
    <select name="site_id" id="site_id" class="easyui-validatebox" required="true" url="" >
    </select>
    <select name="op" id="op" class="easyui-validatebox" required="true" >
    <option value="=">等于</option>
    <option value=">">大于</option>
    <option value="<">小于</option>
    <option value="like">包含</option>
    </select>
    <input name="value" id="value" type="text" class="easyui-validatebox" required="true" />
    </form>
    </div>
    <div id="dlgSearch-buttons">  
        <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="doSearch()">查找</a>  
        <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlgSearch').dialog('close')">取消</a>  
    </div>  
        
</body>
</html>